<?php
/**
 * Created by PhpStorm.
 * User: dutuwang
 * Date: 2019/3/10
 * Time: 6:45
 */

$target = getcwd().'/../'; //回到根目录

echo "Start\n";

$json = json_decode(file_get_contents('php://input'), true);

if (isset($json['password']) && $json['password'] == '123456'){
    $res = shell_exec("cd $target && git pull");
    echo date('Y-m-d H:i:s').",Updated\n";
    print_r($res);
    echo "\n";
}else {

    echo "Password Error\n";

}

echo "End\n";